
package tests.laurens.observable;

import java.util.Observable;
import java.util.Observer;


/**
 * @author Laurens Andriessen
 * @version 1.0
 */
public class Observing implements Observer {

	static ObservedVariable observed = new ObservedVariable();
	/**
	 * 
	 * @author Laurens Andriessen
	 * @param args
	 * @throws InterruptedException
	 */
	public static void main(String[] args) throws InterruptedException {
		// this = new Observing();
		System.out.println(observed.data);
		while(true) {
			Thread.sleep(200);
			observed.doe();
			System.out.println(observed.data);
		}
	}

	public Observing(ObservedVariable observed) {
		observed.addObserver(this);
	}

	public void doeiets() {
		// observed.data = 2;
	}

	public void update(Observable data, Object arg) {
		System.out.println("Update() called!");
	}

}
